 <x:model id="model1">
	<x:instance ref='output-token' id='output-token'>
	  <root xmlns="">
		<%= @transition.output_model || (@requested_tokens.first && @requested_tokens.first.value) %>
	  </root>
	</x:instance>
	<% if Merb::Config[:use_reevaluation] %>
          <x:instance ref='history-tokens' id='history-tokens'>
            <root xmlns="">
              <% if !@case.nil? && !(mode = @case.execution_context.get_mode_with_most_similar_input(@transition, @requested_tokens)).nil?
                    tokens = mode.input_tokens + mode.output_tokens
                    tokens.each do |token|
                      place = token.place%>
                    
                  <place href="<%= url(:place, place) %>" name="<%=place.name%>" id="<%=place.pid%>">
                      <token href="<%= url(:place_token, :place_id => token.place, :id => token) %>" title="<%= token.values["titel"] %>">
                          <%=token.value %>
                      </token>
                  </place>
              
                <%  end
                 end %>
            </root>
          </x:instance>
        <% end %>
	<x:instance ref='incoming-tokens' id='incoming-tokens'>
	  <root xmlns="">
	    <% @transition.incoming_places.each_with_index do |place,i|
	    	req_token = @requested_tokens.select{|token| token.place.id == place.id}.first
                if !req_token.nil?
		%>
		    <place href="<%= url(:place, place) %>" name="<%=place.name%>" id="<%=place.pid%>">
		        <token href="<%= url(:place_token, :place_id => req_token.place, :id => req_token) %>" title="<%= req_token.values["titel"] %>">
		            <%=req_token.value %>
		        </token>
		    </place>
	    <%  end
            end %>
	  </root>
	</x:instance>
	  
	<x:instance ref='process-data' id='process-data' xmlns="">
		<root caseID="<%=@case.id if @case%>">
			<%@transition.petrinet.transitions.each do |trans|%>
				<transition pid="<%=trans.pid%>" href="<%=url(:transition, trans)%>" currentCaseURL="<%= trans.url(:case => @case) %>" />
			<%end%>
		</root>
	</x:instance>
	
	<x:submission id="form1" method="post" action="<%= @transition.url(:tokens => @requested_tokens) %>">
	  <x:toggle case="case-busy" ev:event="xforms-submit" />
	  <x:toggle case="case-submit-error" ev:event="xforms-submit-error" />
	  <x:toggle case="case-done" ev:event="xforms-submit-done" />
	</x:submission>
	<%= @transition.output_bindings %>
</x:model>